package pm.gui.frames;

import pm.PM;

import javax.swing.*;
import java.awt.*;

/**
 * Fullscreen JFrame that capable for displaying a Base Panel.
 * Created by fat3kb
 * Date: 03.02.2008
 * Time: 22:26:56
 */
public class PMFrame extends JFrame {
	public PMFrame() throws HeadlessException {
		super();
		init();
	}

	public PMFrame(final GraphicsConfiguration defaultConfiguration) {
		super(defaultConfiguration);
		init();
	}

	private void init() {
		Rectangle bounds = this.getGraphicsConfiguration().getBounds();
        if(!PM.DEBUG) {
        setAlwaysOnTop(true);
		setUndecorated(true);
        }
        setSize(bounds.width, bounds.height);
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}

	public void setBasePanel(JPanel panel) {
		getContentPane().removeAll();
		getContentPane().add(panel);
		getContentPane().validate();
		getContentPane().repaint();
		if (!isVisible()) {
			setVisible(true);
		}
	}
}
